<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="layout.html" />
  <xi:include href="macros.html" />
  <head>
    <title>Your Builds</title>
  </head>

  <body>
    <div id="content">
        <h1>Your Builds</h1>

        <form class="addnew" method="post" action="">
        <fieldset>
          <legend>Rebuild Port:</legend>
          <table>
            <tr class="field">
              <th><label for="repository">Repository:</label></th>
              <td>
                <select id="repository" name="repository">
                <py:for each="repos in repository">
                  <option value="$repos.id">$repos.name</option>
                </py:for>
                </select>
              </td>
            </tr>
            <tr class="field">
              <th><label for="revision">Revision:</label></th>
              <td><input type="text" name="revision" size="5" /></td>
            </tr>
            <tr class="field">
              <th><label for="portname">Port:</label></th>
              <td><input type="text" name="portname" /></td>
            </tr>
            <tr class="field">
              <th><label for="group">Buildgroups:</label></th>
              <td>
                <select id="group" name="group" multiple="multiple" size="5">
                  <option value="automatic" selected="selected">automatic</option>
                  <option py:for="groups in allbuildgroups">$groups.name</option>
                </select>
              </td>
            </tr>
            <tr class="field">
              <th><label for="description">Description:</label></th>
              <td><textarea name="description" rows="1" cols="25" /></td>
            </tr>
            <tr class="field">
              <th><label for="priority">Priority:</label></th>
              <td>
                <select id="priority" name="priority">
                  <option value="1">highest (limited)</option>
                  <option value="3">high</option>
                  <option value="5" selected="selected">standard</option>
                  <option value="7">low</option>
                  <option value="9">lowest</option>
                </select>
              </td>
            </tr>
          </table>
          <p class="help">
            Schedule a rebuild for a list of ports in your repository.
          </p>
          <div class="buttons">
            <input type="submit" name="addbuild" value="Add" />
          </div>
        </fieldset>
        </form>


        <table class="listing" id="build_list">
            <thead>
                <tr>
                    <th>&nbsp;</th>
                    <th colspan="5">Port</th>
                    <th rowspan="2">Options</th>
                </tr>
                <tr>
                    <th>&nbsp;</th>
                    <th>&nbsp;</th>
                    <th>Buildgroup</th>
                    <th>Status</th>
                    <th>Buildtime</th>
                    <th>Links</th>
                </tr>
            </thead>
            <tbody>
              <py:for each="build in buildqueue">
                <tr class="headfull">
                    <td colspan="5">
                      <py:for each="i, line in enumerate(build.description.split('\n'))">
                        <py:choose>
                          <py:when test="i == 0">
                            <a href="/buildarchive/$build.queueid/"><strong>${line}</strong></a>
                          </py:when>
                          <py:otherwise>${line}</py:otherwise><br />
                        </py:choose>
                      </py:for>
                    </td>
                    <td>
                      <py:if test="build.revision">
                        <a href="$build.repository">r$build.revision</a>
                      </py:if>
                    </td>
                    <td>
                      <form method="post" action="">
                        <input type="hidden" name="queueid" value="$build.queueid" />
                        <input type="submit" name="deletebuild" value="Delete" />
                      </form>
                    </td>
                </tr>
                <py:for each="port in build.ports">
                  <tr py:if="port.head" class="head">
                    <td></td>
                    <td colspan="6">
                      <a href="http://www.freshports.org/$port.portname">
                        <strong>$port.portname <py:if test="port.pkgversion">$port.pkgversion</py:if></strong>
                      </a>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="2"></td>
                    <td><a href="/buildgroups#id-$port.group">$port.group</a></td>
                    <td class="status-$port.buildstatus"><a href="/wiki/Buildstatus" title="($port.status) $port.buildstatus">$port.statusname</a></td>
                    <td>$port.runtime</td>
                    <td>
                      <py:if test="port.buildlog">
                        <a href="$port.directory/$port.buildlog">
                          <img src="${href.chrome('/redports/details.png')}" alt="Buildlog" title="Buildlog" />
                        </a>
                      </py:if>
                      <py:if test="port.wrkdir">
                        <a href="$port.directory/$port.wrkdir">
                          <img src="${href.chrome('/redports/wrkdir.png')}" alt="Work directory" title="Work directory" />
                        </a>
                      </py:if>
                    </td>
                    <td>
                      <py:if test="port.deletable">
                        <form method="post" action="">
                          <input type="hidden" name="id" value="$port.id" />
                          <input type="submit" name="deleteport" value="Delete" />
                        </form>
                      </py:if>
                    </td>
                  </tr>
                </py:for>
              </py:for>
            </tbody>
        </table>
    </div>
  </body>
</html>
